package com.frogs.ucenter.v1.request;

import javax.servlet.http.HttpServletRequest;

import com.frogs.framework.web.HttpRequestInfo;
import com.frogs.system.util.ApiUrlParamEnum;
import com.frogs.system.util.AttentionStateEnum;
import com.frogs.system.web.api.request.Request;
import com.frogs.system.web.exception.RequestIllegalException;

public class UserAttentionRequestLogUpdateRequest extends Request{

	private static final long serialVersionUID = 942328548882776786L;

	private Integer id;
	private Integer sendUserId;
	private Integer operatorUserId;
	private Integer status;
	
	@Override
	public void parse(HttpServletRequest request) {
		HttpRequestInfo requestInfo = new HttpRequestInfo(request);
		this.id = requestInfo.getIntParameter(ApiUrlParamEnum.id.getParamName(), 0);
		this.sendUserId = requestInfo.getIntParameter(ApiUrlParamEnum.sendUserId.getParamName(), 0);
		this.operatorUserId = requestInfo.getIntParameter(ApiUrlParamEnum.operatorUserId.getParamName(), 0);
		this.status = requestInfo.getIntParameter(ApiUrlParamEnum.status.getParamName(), 0);
		if (id < 1) {
			throw new RequestIllegalException("error id:"+"id有误");
		}
		if (sendUserId < 1) {
			throw new RequestIllegalException("error sendUserId:"+"发送人id有误");
		}
		if (operatorUserId < 1) {
			throw new RequestIllegalException("error operatorUserId:"+"操作人id有误");
		}
		//修改的状态必须是同意或拒绝
		if (status != AttentionStateEnum.ATTENTION_STATUS_AGREED.getId()&&status != AttentionStateEnum.ATTENTION_STATUS_REFUSED.getId()) {
			throw new RequestIllegalException("error status:"+"状态值有误");
		}
	}

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public Integer getSendUserId() {
		return sendUserId;
	}

	public void setSendUserId(Integer sendUserId) {
		this.sendUserId = sendUserId;
	}

	public Integer getOperatorUserId() {
		return operatorUserId;
	}

	public void setOperatorUserId(Integer operatorUserId) {
		this.operatorUserId = operatorUserId;
	}

	public Integer getStatus() {
		return status;
	}

	public void setStatus(Integer status) {
		this.status = status;
	}
}
